<template>
  <div class="epMain">
    <div class="epList">
      <div class="head_crumbs clearfix">
        <img src="~@img/public/icon-qiye.png" alt="" />
        <span>{{ tips }}：{{ size }}家</span>
        <el-input
          v-model="name"
          type="text"
          placeholder="输入企业名称或关键字查询"
          @keydown.native.enter="searchEp"
          clearable
        ></el-input>
        <span class="search-btn" @click="searchEp">搜索</span>
        <span class="go_back" @click="$router.go(-1)">返回</span>
      </div>
      <div class="list" v-if="size != 0">
        <div
          class="list_item"
          v-for="item of List"
          :key="item.id"
          @click="goEpDetails(item.id)"
        >
          <p class="item_title">{{ item.name }}</p>
          <div class="clearfix float_box pp">
            <p>
              <span>
                <em v-if="item.isfive">{{ item.isfive }}</em>
                <em v-if="item.quoted_company">{{ item.quoted_company }}</em>
                <em v-if="item.scale">{{ item.scale }}</em>
                <em v-if="item.zjtg">{{ item.zjtg }}</em>
                <em v-if="item.high_new">{{ item.high_new }}</em>
                <em v-if="item.tbe">{{ item.tbe }}</em>
                <em v-if="item.dengl">{{ item.dengl }}</em>
                <em v-if="item.unicorn">{{ item.unicorn }}</em>
              </span>
            </p>
          </div>
          <p class="division"></p>
          <p class="flex_p">
            <span
              >成立时间：<span>{{ item.build_date }}</span>
            </span>
            <span
              >注册资本：<span>{{ item.capital }} </span></span
            >
            <span
              >所属行业：<span>{{ item.industry }} </span>
            </span>
            <!-- <span
              >主营产品：<span>{{ item.product }} </span></span
            > -->
          </p>
          <strong>
            查看详情
          </strong>
        </div>
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page.sync="currentPage"
          :page-size="4"
          layout=" prev, pager, next,jumper"
          :total="size"
        >
        </el-pagination>
      </div>
      <div class="none" v-if="List.length == 0">
        <img src="~@img/public/img-result-none.png" alt="" />
        <div>很抱歉，没有找到相关信息~</div>
      </div>
    </div>
  </div>
</template>

<script>
import { enterList } from "@api/list";
export default {
  data() {
    return {
      tips: "",
      List: [],
      size: 0,
      name: "",
      currentPage: 1,
      per_page: 4,
      old_url: "",
    };
  },
  watch: {
    "$route.fullPath": function(nv, ov) {
      if (this.$route.name == "radareplist" && nv != this.old_url) {
        this.select = this.$route.query.select.toString();
        this.inid = this.$route.query.inid;
        this.area = [
          this.$route.query.area1,
          this.$route.query.area2,
          this.$route.query.area3,
        ];
        this.product = this.$route.query.product;
        switch (this.select) {
          case "1":
            this.tips = "瞪羚企业";
            break;
          case "2":
            this.tips = "高新技术企业";
            break;
          case "3":
            this.tips = "科技型中小企业";
            break;
          case "4":
            this.tips = "上市企业";
            break;
          case "5":
            this.tips = "融资企业";
            break;
          case "6":
            this.tips = "独角兽企业";
            break;
          case "7":
            this.tips = "企业总数";
            break;
        }
        this.$bus.$emit("setActive", this.$route.query.activeMenu);
        this.currentPage = 1;
        this.old_url = nv;
        this.getList();
      }
    },
  },
  mounted() {
    this.old_url = this.$route.fullPath;
    this.select = this.$route.query.select.toString();
    this.inid = this.$route.query.inid;
    this.area = [
      this.$route.query.area1,
      this.$route.query.area2,
      this.$route.query.area3,
    ];
    this.product = this.$route.query.product;
    switch (this.select) {
      case "1":
        this.tips = "瞪羚企业";
        break;
      case "2":
        this.tips = "高新技术企业";
        break;
      case "3":
        this.tips = "科技型中小企业";
        break;
      case "4":
        this.tips = "上市企业";
        break;
      case "5":
        this.tips = "融资企业";
        break;
      case "6":
        this.tips = "独角兽企业";
        break;
      case "7":
        this.tips = "企业总数";
        break;
    }

    this.$bus.$emit("setActive", this.$route.query.activeMenu);
    this.getList();
  },
  methods: {
    async getList() {
      let res = await enterList({
        select: this.select,
        inid: this.inid, //行业id
        area: this.area, //[省， 市， 区]
        product: this.product, // 企业产品（ 链图）
        name: this.name,
        page: this.currentPage,
        perpage: this.per_page,
      });
      if (res.code && res.code != 0) {
        this.List = [];
        this.size = 0;
      } else {
        this.List = res.enter;
        this.size = res.size;
      }
    },
    searchEp() {
      this.currentPage = 1;
      this.getList();
    },
    goEpDetails(id) {
      this.$router.push({
        name: "enterprise",
        params: { id, activeMenu: "radar", type: "qg" },
      });
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getList(val);
    },
  },
};
</script>

<style lang="less" scoped>
.epMain {
  width: 100%;
  height: 100%;
  background: #fafafa;

  .epList {
    box-sizing: border-box;
    margin: 0 auto;
    padding: 20px 0;
    width: 1500px;
    height: 100%;
    .list {
      margin-top: 30px;
    }
  }
}
.none {
  text-align: center;
  font-size: 18px;
  color: #666;
  margin: 180px;
  img {
    width: 234px;
  }
  div {
    margin: 20px;
  }
}
.pp {
  margin-top: 4px;
}
.list_item {
  position: relative;
  box-sizing: border-box;
  margin-top: 20px;
  padding: 0 14px 0 46px;
  width: 100%;
  height: 140px;
  background: #ffffff;
  box-shadow: 0px 0px 6px 0px rgba(86, 86, 86, 0.2);
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  .item_title {
    padding-top: 30px;
    font-size: 22px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    color: #333333;
    text-align: left;
  }
  .float_box p {
    margin-top: 4px;
    float: left;
    font-size: 18px;
    font-family: Microsoft YaHei;
    color: #666666;
    font-weight: 400;
    line-height: 30px;
    // margin-right: 60px;
  }

  .float_box span {
    font-weight: bold;
  }
  .float_box em {
    display: inline-block;
    // width: 140px;
    padding: 0 8px;
    height: 34px;
    background: #f0f0f0;
    border-radius: 4px;
    line-height: 34px;
    text-align: center;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #666666 !important;
    margin-right: 20px;
  }
  .division {
    margin: 8px 0;
    width: 98%;
    height: 2px;
    border-radius: 2px;
    background: #eeeeee;
  }
  .flex_p {
    width: 98%;
    display: flex;
    justify-content: space-between;
    span {
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #999999;
      span {
        color: #333;
      }
    }
  }
  strong {
    position: absolute;
    right: 60px;
    top: 52px;
    margin-top: -14px;
    font-size: 18px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #aaaaaa;
    padding-right: 20px;

    &::after {
      position: absolute;
      right: 0;
      top: 0;
      display: block;
      width: 18px;
      height: 28px;
      content: "";
      background: url("~@img/public/icon-information-normal.png") no-repeat
        center;
    }
  }
  &:hover {
    .item_title {
      font-size: 22px;
      font-weight: bold;
      color: #446db3;
    }
    .float_box em {
      background: #f0f7ff;
      color: #446db3 !important;
    }
    &::after {
      position: absolute;
      top: 0;
      left: -1px;
      display: inline-block;
      content: "";
      width: 7px;
      height: 100%;
      background: #446db3;
      border-radius: 6px 0px 0px 6px;
    }
    strong {
      color: #446db3;
      &::after {
        background: url("~@img/public/icon-information-hover.png") no-repeat
          center;
      }
    }
  }
}
.head_crumbs {
  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #999999;
  text-align: left;
  img {
    vertical-align: middle;
  }
  & > span {
    font-size: 18px;
    font-weight: bold;
    color: #333333;
    vertical-align: middle;
    margin-left: 10px;
  }
  .go_back {
    float: right;
    width: 80px;
    height: 30px;
    line-height: 30px;
    background: #5889dc;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 400;
    color: #ffffff;
    text-align: center;
    cursor: pointer;
  }
}
/deep/ .el-breadcrumb {
  float: left;
}
/deep/ .el-breadcrumb__item {
  font-size: 20px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #999999;
  line-height: 38px;
}
/deep/ .el-breadcrumb__inner.is-link {
  font-weight: 400;
  color: #999;
}
/deep/ .el-breadcrumb__item .el-breadcrumb__inner,
.el-breadcrumb__item .el-breadcrumb__inner a,
.el-breadcrumb__item .el-breadcrumb__inner a:hover,
.el-breadcrumb__item .el-breadcrumb__inner:hover {
  color: #999;
  cursor: pointer;
}

// 表格分页样式修改
.el-pagination {
  text-align: right;
  margin-top: 40px;
}
/deep/ .el-pager li {
  margin: 0 8px;
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  background: #fafafa;
  color: #666666;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
}

/deep/ .el-pager li.active {
  color: #fff;
  background: #5889dc;
  box-shadow: 0px 0px 3px 0px rgba(0, 50, 89, 0.4);
  border-radius: 6px;
}

/deep/ .el-pagination .el-icon-arrow-right:before {
  content: "";
  display: inline-block;
  width: 44px;
  height: 44px;
  background: url("~@img/atlas/icon-page-right.png") no-repeat center;
}
/deep/
  .el-pagination
  button:disabled.btn-next:hover
  .el-icon-arrow-right:before {
  content: "";
  display: inline-block;
  width: 44px;
  height: 44px;
  background: url("~@img/atlas/icon-page-right.png") no-repeat center;
}
/deep/.el-pagination .btn-next:hover .el-icon-arrow-right:before {
  background: url("~@img/atlas/sidenav-hover2.png") no-repeat center;
}
/deep/ .el-pagination .el-icon-arrow-left:before {
  content: "";
  display: inline-block;
  width: 44px;
  height: 44px;
  background: url("~@img/atlas/icon-page-left.png") no-repeat center;
}
/deep/
  .el-pagination
  button:disabled.btn-prev:hover
  .el-icon-arrow-left:before {
  content: "";
  display: inline-block;
  width: 44px;
  height: 44px;
  background: url("~@img/atlas/icon-page-left.png") no-repeat center;
}
/deep/.el-pagination .btn-prev:hover .el-icon-arrow-left:before {
  background: url("~@img/atlas/sidenav-hover1.png") no-repeat center;
}
/deep/ .el-pagination button {
  width: 44px;
  height: 44px;
  padding: 0;
  background: #fafafa;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
}
/deep/ .el-pagination__editor.el-input {
  margin: 0 8px;
}
/deep/ .el-pagination__editor.el-input .el-input__inner:focus {
  color: #5889dc;
}
/deep/ .el-pagination__editor.el-input .el-input__inner {
  height: 44px;
  background: #fafafa;
  box-shadow: 0px 0px 4px 0px rgba(86, 86, 86, 0.11);
  border-radius: 6px;
  font-size: 16px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #cccccc;
}

/deep/ .el-pagination__jump {
  margin-left: 28px;
  height: 44px !important;
  line-height: 44px !important;
}
/*分辨率低于1680，采用下面的样式*/
@media screen and (max-device-width: 1680px) {
  .epMain {
    overflow-y: auto;
    scrollbar-color: #767ffe #e9f3ff;
    scrollbar-width: 6px;
    scrollbar-width: thin;
    overflow-y: auto;
    &::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }
    &::-webkit-scrollbar-thumb {
      border-radius: 10px;
      background: linear-gradient(0deg, #767ffe, #79aefe);
    }
    &::-webkit-scrollbar-track {
      background: #e9f3ff;
      border-radius: 10px;
    }
  }
  .epMain .epList {
    max-width: 1480px;
  }
  .list_item {
    height: 120px;
  }
}

/*分辨率低于1536，采用下面的样式*/
@media screen and (max-device-width: 1536px) {
  .epMain .epList {
    max-width: 1440px;
  }
}
/*分辨率低于1440，采用下面的样式*/
@media screen and (max-device-width: 1440px) {
  .epMain .epList {
    max-width: 1366px;
  }
}

@media only screen and (width: 1366px) {
  .epMain .epList {
    padding: 30px 20px;
    width: 100%;
    overflow-y: scroll;
  }
  .list_item {
    padding: 0 50px 0 80px;
    width: 100%;
  }
  /deep/ .el-pagination {
    text-align: center;
    margin-top: 60px;
  }
  .list_item .item_title {
    font-size: 22px;
  }
}
@media screen and (max-width: 1200px) {
  .epMain .epList {
    padding: 30px 20px 20px;
    width: 100%;
    overflow-y: scroll;
  }
  .list_item {
    padding: 0 50px 0 80px;
    width: 100%;
  }
  .head_crumbs {
    font-size: 16px;
  }
  /deep/ .el-breadcrumb__item {
    font-size: 16px;
  }
  .head_crumbs .go_back {
    height: 32px;
    line-height: 32px;
  }
  .list_item .flex_p span {
    font-size: 14px;
  }
  .list_item .float_box p {
    font-size: 16px;
  }
  .list_item .item_title {
    font-size: 22px;
  }
}
/deep/.head_crumbs .el-input {
  box-sizing: border-box;
  margin-left: 50px;
  width: 328px;
  height: 32px;
  background: #ffffff;
  border-radius: 5px;
}
/deep/.head_crumbs .el-input .el-input__inner {
  box-sizing: border-box;

  width: 328px;
  height: 32px;
}
span.search-btn {
  box-sizing: border-box;
  position: relative;
  margin-left: -70px;
  display: inline-block;
  width: 70px;
  height: 32px;
  line-height: 32px;
  background: #5889dc;
  border-radius: 0px 5px 5px 0px;
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  color: #ffffff;
  text-align: center;
  z-index: 999;
}
</style>
